/*
 * PlaylistPopupMenu.java
 *
 * Created on April 8, 2006, 11:40 AM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package com.bff.mpd.musicjukebox.ui.components;

import com.bff.mpd.musicjukebox.lib.actions.DisplaySongInfoAction;
import com.bff.mpd.musicjukebox.lib.actions.PlaylistInsertAction;
import javax.swing.JFrame;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
import org.bff.javampd.MPDPlaylist;
import org.bff.javampd.objects.MPDSong;

/**
 *
 * @author Bill
 */
public class SonglistPopupMenu extends JPopupMenu {
    private MPDPlaylist playlist;
    
    private JMenuItem addToCurrentPlaylistMenuItem;
    private JMenuItem displaySongInfoMenuItem;
    
    private MPDSong song;
    private JFrame parent;
    
    /** Creates a new instance of PlaylistPopupMenu */
    public SonglistPopupMenu(JFrame parent, MPDPlaylist playlist, MPDSong song) {
        this.playlist = playlist;
        this.song = song;
        this.parent = parent;
        createMenuItems();       
    }
    
    private void createMenuItems() {
        //current playlist
        addToCurrentPlaylistMenuItem = new JMenuItem(new PlaylistInsertAction(playlist, song));
        add(addToCurrentPlaylistMenuItem);

        //song info
        displaySongInfoMenuItem = new JMenuItem(new DisplaySongInfoAction(parent, song));       
        add(displaySongInfoMenuItem);
    }
    
}
